/ Assembly List / LJCNetCommon / HTMLBuilder / GetCreate

Namespace - LJCNetCommon


Parameters
name - The element name.
text - The element content text.
textState - The current text state values.
htmlAttribs - The element attributes.
addIndent - Indicates if the element can be indented.
childIndent - Indicates if the child indent should be applied.
isEmpty - Indicates if an empty element.
close - Indicates if the element will be closed.

Returns

The HTML element.

Syntax

C#
public String GetCreate(String name, String text, TextState textState, Attributes htmlAttribs = null, Boolean addIndent = True, Boolean childIndent = True, Boolean isEmpty = False, Boolean close = True)

Gets an element.

Remarks

GetCreate() is a "GetText" method which creates the element or element opening tag and returns the text value. It is called from other element create methods.
The addIndent parameter defaults to true, which starts the text with the current indent string.
The isEmpty element defaults to false, which does not add the empty element slash.
If isEmpty is true, the empty element slash is added and the close parameter is ignored. The element will not include the closing tag.
The ChildIndentCount is incremented if the element is not empty and not closed.

Example

C#
// Root Method Begin
var textState = new TextState();

// Defaults: IndentCharCount = 2, LineLimit = 80, WrapEnabled = false.
var hb = new HTMLBuilder(textState);

// Example Method:
// Defaults: close = true.
hb.Create("head", null, textState);
var result = hb.ToString();

// result:
// <head></head>

Copyright © Lester J. Clark and Contributors.
Licensed under the MIT License.